package com.jiangdong.craft.controller;

import com.jiangdong.craft.dto.ResponseDTO;
import com.jiangdong.craft.service.RelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/relation")
@CrossOrigin
public class RelationController {

    @Autowired
    RelationService relationService;

    @PostMapping("/add")
    public ResponseDTO add(@RequestParam("startId")Integer startId,
                           @RequestParam("endId")Integer endId,@RequestParam("craftId")Integer craftId){
        return relationService.add(startId,endId,craftId);
    }

    /**
     * @param startId 出发节点的id 要改
     * @param endId   被指向节点的id
     * @return
     */
    @PostMapping("/del")
    public ResponseDTO delRelationBetweenProcedure(@RequestParam("startId")Integer startId,
                                                   @RequestParam("endId")Integer endId,@RequestParam("craftId")Integer craftId){
        return relationService.delRelationBetweenProcedure(startId,endId,craftId);
    }

}
